/*
 * Copyright (C) 2015-2016  Nicola Spanti (RyDroid) <dev@nicola-spanti.info>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */


#ifndef PLANET_WARS_2D_RT_CORE_MODEL_GAME_ESSENTIAL_H
#define PLANET_WARS_2D_RT_CORE_MODEL_GAME_ESSENTIAL_H


#include "PlanetWars2dRT-core/specific/model/universe_essential.h"
#include "PlanetWars2dRT-core/specific/model/players.h"


#ifndef PLANET_WARS_2D_RT_CORE_MODEL_PLAYER_TYPEDEF
#define PLANET_WARS_2D_RT_CORE_MODEL_PLAYER_TYPEDEF 1
typedef struct player_t player_t;
/* useful because of include loop with player */
#endif

DEFINE_VECTOR_GENERIC_STATIC(player_t)


EXTERN_C_BEGIN


struct game_t
{
  struct universe_t universe;
  vector_player_t   players;
  unsigned int      turn;
  
  unsigned char (*get_winner_index)(const struct game_t* this_game);
  
  observers_t observers;
};

typedef struct game_t game_t;


void
game_init_first_time_only(struct game_t* a_game);

void
game_destructor(game_t* game);


EXTERN_C_END


#endif
